// store/useTreeRecordStore.ts
import { defineStore } from 'pinia'
export const useTreeRecordStore = defineStore('treeRecord', {
  state: () => ({
    recordIds: [] as number[],
    recordIndex: -1,
  }),
  getters: {
    getRecordIds: (state) => state.recordIds,
    getRecordIndex: (state) => state.recordIndex
  },
  actions: {
    setRecordIds(recordIds: number[], id: number) {
      this.recordIds = recordIds
      this.recordIndex = recordIds.indexOf(id)
    },
    setRecordIndex(recordIndex: number) {
      this.recordIndex = recordIndex
    }
  }
})